package com.kede.config;

import org.springframework.cache.CacheManager;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.cache.concurrent.ConcurrentMapCache;
import org.springframework.cache.support.SimpleCacheManager;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.Arrays;

/*启用缓存*/
@EnableCaching
@Configuration
public class CacheConfig {
    /*缓存管理对象*/
    @Bean
    CacheManager cacheManager(){
        SimpleCacheManager cacheManager = new SimpleCacheManager();
        cacheManager.setCaches(Arrays.asList(
                /*添加缓存对象*/
                new ConcurrentMapCache("Currentmenulist")

        ));
        return cacheManager;
    }
}
